package com.sth.springframework.context.support;

import com.sth.springframework.beans.factory.support.DefaultListableBeanFactory;
import com.sth.springframework.beans.factory.xml.XmlBeanDefinitionReader;
import com.sth.springframework.context.AbstractRefreshableApplicationContext;

/**
 * @Author: sitianhong
 * @Description:
 * @Since: create in 2021/8/28 0028 11:22
 */
public abstract class AbstractXmlApplicationContext extends AbstractRefreshableApplicationContext {
    @Override
    protected void loadBeanDefinitions(DefaultListableBeanFactory beanFactory) {
        XmlBeanDefinitionReader beanDefinitionReader = new XmlBeanDefinitionReader(beanFactory, this);
        String[] configLocations = getConfigLocations();
        if (null != configLocations){
            beanDefinitionReader.loadBeanDefinitions(configLocations);
        }
    }

    protected abstract String[] getConfigLocations();

}
